/*
 * Copyright 2011 Angel Sanadinov
 *
 * This file is part of VBox WMI.
 *
 * VBox WMI is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * VBox WMI is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with VBox WMI.  If not, see <http://www.gnu.org/licenses/>.
 */

package Beans.Requests.MachineManagement.Components;

import org.virtualbox_3_2.DeviceType;

/**
 * This class represents the boot settings of a virtual machine.
 *
 * @author Angel Sanadinov
 */
public class BootSettings extends MachineManagementComponent
{
    private DeviceType[] devices; //type of device in each boot position

    /**
     * Constructs a boot settings object with the specified data.
     *
     * @param devices the devices in each boot position
     */
    public BootSettings(DeviceType[] devices)
    {
        this.devices = devices;
    }

    /**
     * Retrieves the type of device in each boot position.
     *
     * @return the device types
     */
    public DeviceType[] getDevices()
    {
        return devices;
    }

    /**
     * Retrieves the type of device at the specified boot position. <br><br>
     *
     * <b>Note:</b> <i>The <code>isValid()</code> method of this object must
     * evaluate to <code>true</code> if this operation is to succeed!</i>
     *
     * @param slot the boot position (must be in range)
     * @return
     */
    public DeviceType getDevice(int slot)
    {
        return devices[slot];
    }

    @Override
    public boolean isValid()
    {
        for(DeviceType device: devices)
        {
            if(device == null)
                return false;
            else
                ;
        }

        return true;
    }
}
